* lisp/progmodes/project.el: Don't run modes from .dir-locals.el.
authorJuri Linkov <juri@linkov.net>
Thu, 14 Mar 2024 17:37:44 +0000 (19:37 +0200)
committerJuri Linkov <juri@linkov.net>
Thu, 14 Mar 2024 17:37:44 +0000 (19:37 +0200)
(project--value-in-dir): Use 'alist-get' on 'file-local-variables-alist'
to avoid calling 'hack-local-variables-apply' via
'hack-dir-local-variables-non-file-buffer' because it might enable
undesirable modes such as flyspell-mode in a temporary buffer (bug#69740).

lisp/progmodes/project.el

index 4284ea6edc63a7da9b73eb776eccbdeba86473fa..a7c164f585724239948a374689ddfcb7d3ee9d80 100644 (file)
@@ -808,8 +808,9 @@ DIRS must contain directory names."
   (with-temp-buffer
     (setq default-directory dir)
     (let ((enable-local-variables :all))
-      (hack-dir-local-variables-non-file-buffer))
-    (symbol-value var)))
+      (hack-dir-local-variables))
+    ;; Don't use `hack-local-variables-apply' to avoid setting modes.
+    (alist-get var file-local-variables-alist)))
 
 (cl-defmethod project-buffers ((project (head vc)))
   (let* ((root (expand-file-name (file-name-as-directory (project-root project))))